"""Copyright 2009 Claudio Canepa
Released under BSD license"""
# Startup 0
def adjust_to_correct_appdir():
    import os, sys
    try:
        appdir = sys.argv[0] #feel free to use __file__
        if not appdir:
            raise ValueError
        appdir = os.path.abspath(os.path.dirname(sys.argv[0]))
        os.chdir(appdir)
        import_prefered_dir = os.path.join(appdir,'src')
        sys.path.insert(0,import_prefered_dir)
    except:
        #placeholder for feedback, adjust to your app.
        #remember to use only python and python standart libraries
        #not any resource or module into the appdir 
        #a window in Tkinter can be adequate for apps without console
        #a simple print with a timeout can be enough for console apps
        print 'Please run from an OS console.'
        import time
        time.sleep(10)
        sys.exit(1)
adjust_to_correct_appdir()

# verify PIL available (needed by pyglet)
try:
    import Image
except Exception:
    print 'ERROR: You should install python-imaging.'
    print 'Get it from: http://www.pythonware.com/products/pil/'
    exit(0)

# Startup 1
import main
main.main()
